//
//  MantisRightAcademicTableViewCell.m
//  NLProjectFrameworkDemo
//
//  Created by iosdeveloper on 2020/5/6.
//  Copyright © 2020 yj_zhang. All rights reserved.
//

#import "MantisRightAcademicTableViewCell.h"

@implementation MantisRightAcademicTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpView];
    }
    return self;
}

-(void)setUpView{
    [super setUpView];
   
    self.bgView.backgroundColor=[UIColor clearColor];

    self.btnLabel=[UILabel new];
    self.btnLabel.font = KIMFontRegularSize(16);
    self.btnLabel.textColor=[UIColor whiteColor];
    self.btnLabel.numberOfLines=1;
    self.btnLabel.textAlignment=NSTextAlignmentCenter;
    [self.bgView addSubview:self.btnLabel];
    
    ViewRadius(self.btnLabel, 4);
}


-(void)reloadCellModel:(MantisCellBaseModel *)data{
    [super reloadCellModel:data];
    MantisTextCellSubContentData*btnData=( MantisTextCellSubContentData*)data;
    self.cellBaseData=btnData;
    self.btnLabel.text =btnData.label;
    self.btnLabel.backgroundColor = [UIColor jk_colorWithHexString:btnData.bgColor];
    
    CGSize labelSize =btnData.contentSize;
    CGSize bgSize = CGSizeMake(labelSize.width+10, labelSize.height+6);
    [self setThreeCorner:bgSize bgView:self.bgView];//切角
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.equalTo(self.avaterView.mas_left).offset(-adaptWidth750(20));
         make.top.equalTo(self.avaterView);
         make.size.mas_equalTo(bgSize);
     }];
   
    
    
    
    [self.btnLabel mas_makeConstraints:^(MASConstraintMaker *make) {
          make.center.mas_equalTo(self.bgView);
        make.size.mas_equalTo(labelSize);
      }];
    
}







- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
